const monitorTypes = ['监测体', '传感器类型', '传感器'];
const queryMonitorSensor = {};
let timeObj = [];
let chartsID = 0;
let eveData = [];

//创建一个alertList类
function KkAlertList() {}
//为alertList绑定原型
KkAlertList.prototype = {
    //定义类
    constructor: KkAlertList,
    //build函数return选择框dom
    build: function (listName) {
            return  '<div class="alertBox_list">' +
                    '<p>'+ listName +'</p>' +
                    '<select>' +
                    '<option value="default">请选择'+ listName +'</option>' +
                    '</select>' +
                    '</div>'
    },
    del: function (ele, listName) {
        return $(ele).find('select').html('<option value="default">请选择'+ listName +'</option>')
    }
};
//设置弹窗显示
const handleClickAlert = function() {$('#alertBox').css('display', 'block')};
//设置弹窗背景点击隐藏
const handleClickBk = function () {$('#alertBox').css('display', 'none')};
//判断传感器类型并返回
const kkSetOptVal = function(name) {
    let kk;
    name === "北斗" ? kk = "00" : kk = "02";
    return kk
};
//创建点击事件绑定弹窗
const handleClickBindAlert = function() {
    if($('#kkChartAlert')) {$('#kkChartAlert').remove()}
    $('#mainBox').prepend('<div id="kkChartAlert" class="kkAlertStyle"><div id="chartAlert_content"></div><div class="arrows leftArrow" style="left: 20%;"><</div><div class="arrows rightArrow" style="right: 20%;">></div><div id="chartAlert_bg" class="kkBlack"></div></div>');
    $('#kkChartAlert').css('display', 'block');
    $('#chartAlert_bg').on('click', function () {$('#kkChartAlert').css('display', 'none')});
    $('#chartAlert_content').html('<div id="largeChart'+ chartsID +'" style="height: 100%; width: 100%"></div>');
    //创建echart对象
    let largerChart = echarts.init(document.getElementById('largeChart'+chartsID));
    //用变量接收弹窗中的自定属性chartsid
    const kk = $(this).attr('chartsid');
    
    let kkChange = kk * 1;
    console.log(kk, eveData, this)
    /*
    根据judgePoint字段判断传感器类型，
    并根据相应的传感器类型去使用不同的图表创建方法
    */ 
    switch (eveData[kk].judgePoint) {
        case "00":
            if(eveData[kk].query.referenceName === 'CGCS2000坐标系') {
                addWGS84Chart(eveData[kk].query, eveData[kk].list, eveData[kk].sensorName, largerChart);
            }
            if(eveData[kk].query.referenceName === '矿区坐标高程系统') {
                addBJ54Chart(eveData[kk].query, eveData[kk].list, eveData[kk].sensorName, largerChart);
            }
            break;
        case "01":
            initRockOffset(eveData[kk].query, eveData[kk].list, eveData[kk].sensorName, largerChart);
            break;
        case "02":
            initRainfallChart(eveData[kk].query, eveData[kk].list, eveData[kk].sensorName, largerChart)

    }
    //向左点击返回前一个图表
    $('.leftArrow').on('click', function () {

        if(kkChange > 0) {
            kkChange -= 1;
            judgeReferenceName(kkChange)
       } else {
           alert('已经是第一个了')
       }
        console.log("leftEnd=========>", kkChange, kk, chartsID)
    });
    //向右点击生成下一个已经存在的图表
    $('.rightArrow').on('click', function () {
        if(kkChange < chartsID - 1) {

            kkChange = kkChange + 1;
            judgeReferenceName(kkChange)
        } else {
            alert('已经是最后一个了')
        }
        console.log("rightEnd=========>", kkChange, kk, chartsID)
    })
};
//左右切换时创建图表
const judgeReferenceName = function (num) {
    $('#largeChart' + chartsID).html('');
    let largerChart = echarts.init(document.getElementById('largeChart'+chartsID));
    if(eveData[num].judgePoint === "00") {
        if(eveData[num].query.referenceName === 'CGCS2000坐标系') {
            addWGS84Chart(eveData[num].query, eveData[num].list, eveData[num].sensorName, largerChart);
        }
        if(eveData[num].query.referenceName === '矿区坐标高程系统') {
            addBJ54Chart(eveData[num].query, eveData[num].list, eveData[num].sensorName, largerChart);
        }
    }
    if (eveData[num].judgePoint === "01") {
        initRockOffset(eveData[num].query, eveData[num].list, eveData[num].sensorName, largerChart);
    }
    if(eveData[num].judgePoint === "02") {
        initRainfallChart(eveData[num].query, eveData[num].list, eveData[num].sensorName, largerChart);
    }
};
//给图表增加删除方法
const handleClickBindDel = function() {
    const delObj = Number($(this).attr('chartsid'));
    eveData.splice(delObj, 1);
    $(this).parent().remove();
    let k = $('.delBtn');
    for(let i = delObj ; i < k.length; i++) {
        $(k[i]).attr('chartsid', Number($(k[i]).attr('chartsid')) - 1);
        $(k[i]).parent().attr('chartsid', Number($(k[i]).parent().attr('chartsid')) - 1);
        $(k[i]).next().attr('chartsid', Number($(k[i]).next().attr('chartsid')) - 1);
    }
    chartsID -= 1;
};

$(function () {
    changeSystemStyle(21, 0);
    for(let i = 0; i < monitorTypes.length; i++) {
        $('#alertBox_content').append(KkAlertList.prototype.build(monitorTypes[i]))
    }
    const selects = $('#alertBox_content').find('select');
    for(let i = 1; i < selects.length; i++) {
        $(selects[i]).attr('disabled', true)
    }
    const beginTime = new Date();
    const endTime = new Date();
    new Date(beginTime.setMonth((new Date().getMonth()-1)));
    $('#alertBox_btn').attr('disabled', true);
    $('#startTime0').val(beginTime.Format('yyyy-MM-dd'));
    $('#endTime0').val(endTime.Format('yyyy-MM-dd'));
});

$('#mainBox_content').html('<div class="mainBox_ChartBox needClick"><p>+</p></div>');
$('.needClick').on('click', handleClickAlert);
$('#alertBox_black').on('click', handleClickBk);
//请求接口
YhHttp.init(YhHttpConstant.ServiceKey.LIST_MONITOR_SENSOR);
YhHttp.send(queryMonitorSensor, function (result) {

    const resultObj = JSON.parse(result);
    console.log("resultOK");
    const selectsDad = $('.alertBox_list');
    const monitorList = resultObj.parameter.list;
    let productEnumName = [];
    let eveMonitor = {
        bds: [],
        yts: [],
        qxs: []
    };
    for(let i = 0; i < selectsDad.length; i++) {
        if (i === 0) {
            for(let k = 0; k < monitorList.length; k++) {
                $(selectsDad[i]).find('select').append('<option value="'+ monitorList[k].id +'">'+ monitorList[k].monitorName +'</option>')
            }
            $(selectsDad[i]).find('select').on('change', function () {
                productEnumName = [];
                eveMonitor = {
                    bds: [],
                    yts: [],
                    qxs: []
                };
                if($(this).val() !== 'default') {
                    KkAlertList.prototype.del(selectsDad[i+1], monitorTypes[i+1]);
                    KkAlertList.prototype.del(selectsDad[i+2], monitorTypes[i+2]);
                    $(selectsDad[i+1]).find('select').attr('disabled', false);
                    for(let k = 0; k < monitorList.length; k++) {
                        if(monitorList[k].id === Number($(this).val())) {
                            for(let j = 0; j < monitorList[k].sensorList.length; j++) {
                                let sensorList = monitorList[k].sensorList[j];
                                let kk;
                                switch (sensorList.moduleEnum) {
                                    case "00":
                                        kk = '北斗';
                                        eveMonitor.bds.push(sensorList);
                                        if(productEnumName.indexOf(kk) === -1) {productEnumName.push(kk)}
                                        break;
                                    case "01":
                                        kk = '岩土';
                                        eveMonitor.yts.push(sensorList);
                                        if(productEnumName.indexOf(kk) === -1) {productEnumName.push(kk)}
                                        break;
                                    case "02":
                                        kk = "气象";
                                        eveMonitor.qxs.push(sensorList);
                                        if(productEnumName.indexOf(kk) === -1) {productEnumName.push(kk)}
                                }
                            }
                        }
                    }
                } else {
                    $(selectsDad[i+1]).find('select').attr('disabled', true);
                    $(selectsDad[i+2]).find('select').attr('disabled', true);
                }
                for(let p = 0; p < productEnumName.length; p++) {
                    $(selectsDad[i+1]).find('select').append('<option value="'+ kkSetOptVal(productEnumName[p]) +'">'+ productEnumName[p] +'</option>')
                }
                $(selectsDad[i+1]).find('select').on('change', function () {
                    if($(this).val() !== "default") {
                        KkAlertList.prototype.del(selectsDad[i+2], monitorTypes[i+2]);
                        $(selectsDad[i+2]).find('select').attr('disabled', false);
                        switch ($(this).val()) {
                            case "00":
                                for (let v = 0; v < eveMonitor.bds.length; v++) {
                                    $(selectsDad[i+2]).find('select').append('<option value="'+ eveMonitor.bds[v].sensorNumber +'">'+ eveMonitor.bds[v].sensorName +'</option>')
                                }
                                break;
                            case "01":
                                for (let v = 0; v < eveMonitor.yts.length; v++) {
                                    $(selectsDad[i+2]).find('select').append('<option value="'+ eveMonitor.yts[v].sensorNumber +'">'+ eveMonitor.yts[v].sensorName +'</option>')
                                }
                                break;
                            case "02":
                                for (let v = 0; v < eveMonitor.qxs.length; v++) {
                                    $(selectsDad[i+2]).find('select').append('<option value="'+ eveMonitor.qxs[v].sensorNumber +'">'+ eveMonitor.qxs[v].sensorName +'</option>')
                                }
                                break;
                        }
                    }else {
                        $(selectsDad[i+2]).find('select').attr('disabled', true);
                    }
                })
                $(selectsDad[i+2]).find('select').on('change', function () {
                    if($(this).val() !== "default") {
                        $('#alertBox_btn').attr('disabled', false).css('background', '#0f0f0f')
                    }
                })
            })
        }

    }
});

const addWGS84Chart = function (queryData, list, sensorName, addEcharts) {
    let xdata = [];
    let ydata = [];
    let hdata = [];
    let pdata = [];
    let theDate = [];
    let length = list.length;
    for (let j = 0; j < length; j++) {
        xdata.push((list[j].xdata * 1000).toFixed(1));
        ydata.push((list[j].ydata * 1000).toFixed(1));
        hdata.push((list[j].hdata * 1000).toFixed(1));
        pdata.push((list[j].pdata * 1000).toFixed(1));
        theDate.push(new Date(list[j].theDate / 1).Format("yyyy-MM-dd"));
    }
    let chartOption = {
        title: {
            text: sensorName + '站点' + queryData.startTime + '至' + queryData.endTime + '内单点变形分析（' + queryData.referenceName + '）',
            left: 'center'
        },
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            top: 30,
            data: ['x平移', 'y平移', 'H下沉', '平面位移']
        },
        grid: {
            left: '3%',
            right: '8%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            name: '时间',
            type: 'category',
            boundaryGap: false,
            data: theDate,
            // axisLabel: {
            //     interval: 0
            // }
        },
        yAxis: {
            name: '位移(mm)',
            type: 'value',
            // axisLabel: {
            //     formatter: '{value} mm'
            // }
        },
        color: ['#027602', '#0101F6', '#840284', '#FF0000', '#27727B',
            '#FE8463', '#9BCA63', '#FAD860', '#F3A43B', '#60C0DD',
            '#D7504B', '#C6E579', '#F4E001', '#F0805A', '#26C0C0'],
        series: [{
            name: 'x平移',
            type: 'line',
            smooth: true,
            lineStyle: {
                normal: {
                    width: 3
                }
            },
            data: xdata
        },
            {
                name: 'y平移',
                type: 'line',
                smooth: true,
                lineStyle: {
                    normal: {
                        width: 3
                    }
                },
                data: ydata
            },
            {
                name: 'H下沉',
                type: 'line',
                smooth: true,
                lineStyle: {
                    normal: {
                        width: 3
                    }
                },
                data: hdata
            },
            {
                name: '平面位移',
                type: 'line',
                smooth: true,
                lineStyle: {
                    normal: {
                        width: 3
                    }
                },
                data: pdata
            }
        ]
    };
    addEcharts.clear();
    addEcharts.setOption(chartOption);
    addEcharts.resize();
};

const addBJ54Chart = function (queryData, list, sensorName, addEcharts) {
    let x54Change = [];
    let y54Change = [];
    let z54Change = [];
    let pdata = [];
    let theDate = [];
    let length = list.length;
    for (let j = 0; j < length; j++) {
        x54Change.push((list[j].x54Change * 1000).toFixed(1));
        y54Change.push((list[j].y54Change * 1000).toFixed(1));
        z54Change.push((list[j].z54Change * 1000).toFixed(1));
        pdata.push((list[j].pdata * 1000).toFixed(1));
        theDate.push(new Date(list[j].theDate / 1).Format("yyyy-MM-dd hh:mm:ss"));
    }
    let chartOption = {
        title: {
            text: sensorName + '站点' + queryData.startTime + '至' + queryData.endTime + '内单点变形分析（' + queryData.referenceName + '）',
            left: 'center'
        },
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            top: 30,
            data: ['x平移', 'y平移', 'H下沉', '平面位移']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        toolbox: {
            feature: {
                saveAsImage: {}
            },
            right: '5%'
        },
        xAxis: {
            name: '时间',
            type: 'category',
            boundaryGap: false,
            data: theDate
        },
        yAxis: {
            name: '位移(mm)',
            type: 'value',
            // axisLabel: {
            //     formatter: '{value} mm'
            // }
        },
        color: ['#027602', '#0101F6', '#840284', '#FF0000', '#27727B',
            '#FE8463', '#9BCA63', '#FAD860', '#F3A43B', '#60C0DD',
            '#D7504B', '#C6E579', '#F4E001', '#F0805A', '#26C0C0'],
        series: [{
            name: 'x平移',
            type: 'line',
            smooth: true,
            lineStyle: {
                normal: {
                    width: 3
                }
            },
            data: x54Change
        },
            {
                name: 'y平移',
                type: 'line',
                smooth: true,
                lineStyle: {
                    normal: {
                        width: 3
                    }
                },
                data: y54Change
            },
            {
                name: 'H下沉',
                type: 'line',
                smooth: true,
                lineStyle: {
                    normal: {
                        width: 3
                    }
                },
                data: z54Change
            },
            {
                name: '平面位移',
                type: 'line',
                smooth: true,
                lineStyle: {
                    normal: {
                        width: 3
                    }
                },
                data: pdata
            }
        ]
    };
    addEcharts.clear();
    addEcharts.setOption(chartOption);
    addEcharts.resize();
};

const initRockOffset = function (queryData, list, sensorName, addEcharts) {
        let xData = [];
        let yData = [];
        for (let i = 0; i < list.length; i++) {
            xData.push(list[i].collectDate);
            yData.push(Math.abs(list[i].waterPressure));
        }
        let chartOption = {
            title: {
                text: sensorName + '裂缝计',
                left: 'center'
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'shadow'
                }
            },
            legend: {
                top: 30,
                data: ['裂缝(mm)']
            },
            grid: {
                left: '20%',
                right: '20%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: {
                name: '时间',
                type: 'category',
                boundaryGap: true,
                data: xData
            },
            yAxis: {
                name: '裂缝（mm）',
                type: 'value',
                axisLabel: {
                    formatter: '{value} mm'
                }
            },
            series: [{
                name: '裂缝(mm)',
                type: 'line',
                barGap: 0,
                color: ['#99cc66'],
                data: yData
            }
            ]
        };
        addEcharts.setOption(chartOption);
        addEcharts.resize();
};

const initRainfallChart = function (queryData, list, sensorName, addEcharts) {
    let collectTimeData = [];
    let rainfallData = [];
    for (let i = 0; i < list.length; i++) {
        collectTimeData.push(list[i].collectTime);
        rainfallData.push(list[i].rainFall);
    }
    let chartOption = {
        title: {
            text: sensorName + '站点' + queryData.startTime + '至' + queryData.endTime + '内雨量',
            left: 'center'
        },
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            top: 30,
            data: ['雨量']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        calculable: true,
        xAxis: [
            {
                type: 'category',
                axisTick: {
                    alignWithLabel: true
                },
                data: (function () {
                    let data = [];
                    if (collectTimeData[0] != '') {
                        for (let i = 0; i < collectTimeData.length; i++) {
                            data.push(new Date(collectTimeData[i].replace(/-/g, "/")).Format('yyyy-MM-dd hh'));
                        }
                    }
                    return data;
                }())
            }
        ],
        yAxis: [
            {
                axisLabel: {
                    formatter: '{value} mm'
                },
                type: 'value'
            }
        ],
        series: [
            {
                name: '雨量',
                type: 'bar',
                barWidth: '60%',
                data: (function () {
                    let data = [];
                    for (let i = 0; i < rainfallData.length; i++) {
                        data.push(rainfallData[i]);
                    }
                    return data;

                }()),
                itemStyle: {
                    //通常情况下：
                    normal:{
                        //每个柱子的颜色即为colorList数组里的每一项，如果柱子数目多于colorList的长度，则柱子颜色循环使用该数组
                        color: function (params){
                            let colorList = [];
                            for (let i = 0; i < rainfallData.length; i ++) {
                                let rainFall = rainfallData[i];
                                if (rainFall >= 50) {
                                    colorList.push('rgb(226, 10, 23)');
                                } else if (rainFall >= 40 && rainFall < 50) {
                                    colorList.push('rgb(252, 113, 20)');
                                } else if (rainFall >= 15 && rainFall < 40) {
                                    colorList.push('rgb(255, 210, 10)');
                                } else if (rainFall >= 7 && rainFall < 15) {
                                    colorList.push('rgb(74, 140, 254)');
                                } else {
                                    colorList.push('rgb(32, 208, 254)');
                                }
                            }
                            return colorList[params.dataIndex];
                        }
                    },

                },
            }
        ],
        label: {
            normal: {
                show: true,
                position: 'top',
                textStyle: {
                    color: 'black'
                }
            }
        }

    };
    addEcharts.setOption(chartOption);
    addEcharts.resize();
};
//差选数据的方法
const queryEveData = function(parObj) {
    //拿到select的值
    const judgePoint = $('.alertBox_list').eq(1).find('select').find('option:selected').val();
    const sensorName = $('.alertBox_list').eq(2).find('select').find('option:selected').text();
    const sensorNumber = $('.alertBox_list').eq(2).find('select').find('option:selected').val();
    switch (judgePoint) {
        case '00':
            let queryData = {
                referenceName: '',
                sensorNumber: ''
            };
            for(let i = 0; i < parObj.length; i++) {
                let kk = parObj[i];
                queryData[kk.name] = kk.value
            }
            queryData.referenceName = $('#referenceType option:selected').text();
            queryData.sensorNumber = sensorNumber;
            YhHttp.init(YhHttpConstant.ServiceKey.QUERY_PLANE_ANALYSIS);
            YhHttp.send(queryData, function (result) {
                let resultObj = JSON.parse(result);
                let list = resultObj.parameter.list;
                if (list !== null && list !== 'undefined') {
                    if (list !== 0) {
                        $('#alertBox').hide();
                        $('.needClick')
                            .eq(0)
                            .prop("onclick",null)
                            .off("click")
                            .html('<span class="delBtn" chartsID="'+ chartsID +'">-</span><div id="chartBox'+ chartsID +'" style="height: 100%; width: 100%; " chartsID="'+ chartsID +'"></div>')
                            .addClass('bindAlert')
                            .attr('chartsID', chartsID)
                            .removeClass('needClick');
                        eveData.push({query: queryData, sensorName: sensorName, list: list, judgePoint: judgePoint});
                        const addEcharts = echarts.init(document.getElementById('chartBox'+chartsID));
                        switch (queryData.referenceName) {
                            case "CGCS2000坐标系":
                                addWGS84Chart(queryData, list, sensorName, addEcharts);
                                break;
                            case "矿区坐标高程系统":
                                addBJ54Chart(queryData, list, sensorName, addEcharts);
                                break;
                        }
                        $('#mainBox_content').append('<div class="mainBox_ChartBox needClick"><p>+</p></div>');
                        $('.needClick').on('click', handleClickAlert);
                        chartsID+=1;
                        document.getElementsByClassName('bindAlert')[chartsID - 1].getElementsByTagName('div')[0].addEventListener('click', handleClickBindAlert);
                        document.getElementsByClassName('delBtn')[chartsID - 1].addEventListener('click', handleClickBindDel);
                    } else {
                        $('#history-grid').html('暂无历史数据');
                    }
                }
            });
            break;
            case '01':
                let parameter = {
                    tunnelNumber: '',
                    sensorNumber: ''
                };
                for(let i = 0; i < parObj.length; i++) {
                    let kk = parObj[i];
                    parameter[kk.name] = kk.value
                }
                delete parameter.referenceType;
                delete parameter.timeType;
                parameter.sensorNumber = sensorNumber;
                YhHttp.init(YhHttpConstant.ServiceKey.QUERY_GAP_BY_DATE);
                YhHttp.send(parameter, function (result) {
                    let resultObj = JSON.parse(result);
                    let list = resultObj.parameter.list;
                    if (list !== null && list !== 'undefined') {
                        $('#alertBox').hide();
                        $('.needClick')
                            .eq(0)
                            .prop("onclick",null)
                            .off("click")
                            .html('<span class="delBtn" chartsID="'+ chartsID +'">-</span><div id="chartBox'+ chartsID +'" style="height: 100%; width: 100%; " chartsID="'+ chartsID +'"></div>')
                            .addClass('bindAlert')
                            .attr('chartsID', chartsID)
                            .removeClass('needClick');
                        eveData.push({query: parameter, sensorName: sensorName, list: list, judgePoint: judgePoint});
                        const addEcharts = echarts.init(document.getElementById('chartBox'+chartsID));
                        initRockOffset(parameter, list, sensorName, addEcharts);
                        $('#mainBox_content').append('<div class="mainBox_ChartBox needClick"><p>+</p></div>');
                        $('.needClick').on('click', handleClickAlert);
                        // $('.bindAlert').on('click', handleClickBindAlert);
                        chartsID+=1;
                        document.getElementsByClassName('bindAlert')[chartsID - 1].getElementsByTagName('div')[0].addEventListener('click', handleClickBindAlert);
                        document.getElementsByClassName('delBtn')[chartsID - 1].addEventListener('click', handleClickBindDel);
                    }
                });
            break;
        case "02":
            let rainParam = {
                sensorNumber: '',
                tunnelNumber: ''
            };
            for(let i = 0; i < parObj.length; i++) {
                let kk = parObj[i];
                rainParam[kk.name] = kk.value
            }
            delete rainParam.referenceType;
            delete rainParam.timeType;
            rainParam.sensorNumber = sensorNumber;
            YhHttp.init(YhHttpConstant.ServiceKey.QUERY_RAIN_FALL_BY_DATE);
            YhHttp.send(rainParam, function (result) {
                var resultObj = JSON.parse(result);
                let list = resultObj.parameter.list;
                if (list !== null && list !== '') {
                    $('#alertBox').hide();
                    $('.needClick')
                        .eq(0)
                        .prop("onclick",null)
                        .off("click")
                        .html('<span class="delBtn" chartsID="'+ chartsID +'">-</span><div id="chartBox'+ chartsID +'" style="height: 100%; width: 100%; " chartsID="'+ chartsID +'"></div>')
                        .addClass('bindAlert')
                        .attr('chartsID', chartsID)
                        .removeClass('needClick');
                    eveData.push({query: rainParam, sensorName: sensorName, list: list, judgePoint: judgePoint});
                    const addEcharts = echarts.init(document.getElementById('chartBox'+chartsID));
                    initRainfallChart(rainParam, list, sensorName, addEcharts);
                    $('#mainBox_content').append('<div class="mainBox_ChartBox needClick"><p>+</p></div>');
                    $('.needClick').on('click', handleClickAlert);
                    // $('.bindAlert').on('click', handleClickBindAlert);
                    chartsID+=1;
                    document.getElementsByClassName('bindAlert')[chartsID - 1].getElementsByTagName('div')[0].addEventListener('click', handleClickBindAlert);
                    document.getElementsByClassName('delBtn')[chartsID - 1].addEventListener('click', handleClickBindDel);
                }
            })
    }

};

$('#alertBox_btn').on('click', function () {
    timeObj = [];
    timeObj=$('#exportForm').serializeArray();
    queryEveData(timeObj);
});
